scalebutton: Shorten finalize() implementation
authorTimm Bäder <mail@baedert.org>
Mon, 27 Apr 2020 09:56:55 +0000 (11:56 +0200)
committerTimm Bäder <mail@baedert.org>
Tue, 5 May 2020 06:20:09 +0000 (08:20 +0200)
gtk/gtkscalebutton.c

index 4029279bf8bdd6d81cf2c4ab5a1eb175467a812d..930b026406fdc48cd91e0f74ab99181ee538c74e 100644 (file)
@@ -512,20 +512,9 @@ gtk_scale_button_finalize (GObject *object)
   GtkScaleButton *button = GTK_SCALE_BUTTON (object);
   GtkScaleButtonPrivate *priv = gtk_scale_button_get_instance_private (button);
 
-  if (priv->icon_list)
-    {
-      g_strfreev (priv->icon_list);
-      priv->icon_list = NULL;
-    }
-
-  if (priv->adjustment)
-    {
-      g_object_unref (priv->adjustment);
-      priv->adjustment = NULL;
-    }
-
-  if (priv->autoscroll_timeout)
-    g_source_remove (priv->autoscroll_timeout);
+  g_clear_pointer (&priv->icon_list, g_strfreev);
+  g_clear_object (&priv->adjustment);
+  g_clear_handle_id (&priv->autoscroll_timeout, g_source_remove);
 
   G_OBJECT_CLASS (gtk_scale_button_parent_class)->finalize (object);
 }